<template>
	<view class="route-spots">
			<view class="spots-order flex--row">
				<view v-for="(route,index) in routeAttractionsList" class="flex--row spots-order-item">
					<view class="order-number text--secondary-dark" :class="{'active':index === spotIndex}" @click.stop="changeSpotIndex(index)" role="button" :aria-label="'第'+index+1+'个景点'"> {{index+1}}</view>
					<image src="@/static/arrow.svg" aria-label="箭头" class="icon--small"></image>
				</view>
			</view>
			<view class="spots-detail flex--row">
				<view class="detail--side flex--row">
					<view class="detail-image icon--large">
						<image :src="routeAttractionsList[spotIndex].img" mode="center" :aria-label="routeAttractionsList[spotIndex].attractionsName+'的图片'"></image>
					</view>
					<view class="detail-desc flex--col">
						<view class="text--secondary-dark" v-show="routeAttractionsList[spotIndex].attractionsName">{{ routeAttractionsList[spotIndex].attractionsName}}</view>
						<view class="text--secondary-dark" v-show="routeAttractionsList[spotIndex].name">{{ routeAttractionsList[spotIndex].name}}</view>
						<text class="text--thirdary-dark">{{ routeAttractionsList[spotIndex].description }}</text>
					</view>
				</view>
				<view class="detail--side">
					<image :src="`../../static/numbers/${spotIndex+1}.svg`" :aria-lable="'第'+spotIndex+1+'站'" class="icon"></image>
				</view>
			</view>
	</view>
</template>

<script>
	export default{
		props:['routeAttractionsList','spotIndex'],
		emits:['changeSpotIndex'],
		methods:{
			changeSpotIndex(index){
				this.$emit('changeSpotIndex',index)
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	.text--main-dark{
		font-size: 24px;
		font-weight: 700;
		color:#333;
	}
	
	.text--secondary-dark{
		font-size: 16px;
		font-weight: 600;
		color:#333;
	}
	
	.text--thirdary-dark{
		font-size: 14px;
		font-weight: 400;
		color:#333;
	}
	
	.order-number{
		text-align: center;
		width:18px;
		height:18px;
		padding:4px;
		border-radius: 50%;
		border:1px solid #333;
		
		
		&.active{
			background-color: #333;
			color:#fff;
		}
	}
	
	.route-spots{
		.spots-order{
			gap:4px;
			justify-content: center;
			align-items: center;
			
			margin-bottom: 8px;
			
			&-item{
				align-items: center;
				gap:2px;
			}
			
			&-item:last-child image{
				align-items: center;
				gap:2px;
				display: none;
			}
			
			
		}
	
		.spots-detail{
			justify-content: space-around;
			align-items: center;
		}
		
		.detail--side{
			gap:4px;
		}
		
		.detail-image{
			@include border-four-roundings;
			overflow: hidden;
			padding:2px;
			
			image{
				width:100%;
				height:100%;
				border-radius: 10px;
			}
		}
		
		.detail-desc{
			padding:6px 0px;
			justify-content: space-between;
		}
		
	}
</style>